home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / maximus / mul100.zip / EXPWARN.SCR < prev    next >
Text File  |  1993-02-01  |  3KB  |  75 lines

  1.  
  2. // EXPWARN.SCR  --  Maximus Warn of Pending Expiry  --  Version 1.00
  3. //
  4. // Script program for MUL - the Maximus User Language
  5. // MUL is (C) Copyright 1990-93 by CodeLand Australia
  6.  
  7. // ExpWarn scans your user file for records with a date expiry setting.
  8. // Each record found is checked for a match of days to expiry with the
  9. // 'warndays' variable setting. Where matches are found, the 'warnexp'
  10. // command line entry is executed. This enables functions such as posting a
  11. // message to warn users of a pending expiry. Several utilities exist to
  12. // write to both *.msg and Sqsh message bases, the one used as an example
  13. // here is MsgPost, a utility also by this author. Note that MsgPost v1.01
  14. // or higher is required, because MsgPost v1.00 did not possess the -F and
  15. // -L command line options.
  16.  
  17. // This script is based on the executable of the same name, also by
  18. // this author, originally written for Simon Blears of 3:690/601.
  19.  
  20. char *ufile = "USER.BBS";                   // Path & name of Maximus user file
  21. //char *ufile = "C:\\BBS\\USER.BBS";        // Path & name of Maximus user file
  22.  
  23. int warndays=14;                            // Issue warning days before expiry
  24.  
  25. // Post a message to accounts with expiry pending in 'warndays' days
  26. // In the example below, MsgPost will post a message to the user
  27. // warning of the pending expiry.
  28. char *warnexp = "MsgPost -TC:\\Util\\WarnExp.Txt \"-F%s\"";
  29.  
  30. char *banner = "EXPWARN v1.00";             // Script banner
  31. char *desc = "Warn of Pending Expiry";      // Description
  32.  
  33. main ()                                     // Main program
  34. {
  35.     printf ("\n%s - %s\n\n",banner,desc);   // Announce
  36.  
  37.     if (!BaseOpenR (ufile)) {
  38.         printf ("ERROR opening user file %s\n",ufile);
  39.         saybibi (); exit ();
  40.     }
  41.  
  42.     scanufile ();                           // Process the user file
  43.  
  44.     BaseClose ();                           // Close the user base
  45.     saybibi ();                             // Was it good for you too?
  46. }
  47.  
  48. scanufile ()                                // Process the user file
  49. {
  50.     int rec=1;
  51.     char buf[128];
  52.  
  53.     while (BaseRead (rec++)) {              // Read all records
  54.  
  55.         if (And (USRxpflag,XP_DATE)) {      // If expire by date
  56.  
  57.             if (BaseDaysXpry () == warndays) {
  58.                 printf("Warning: %04u %-25s\n",rec,USRname);
  59.                 sprintf (buf,warnexp,USRname);
  60.                 system (buf);
  61.             }
  62.         }
  63.  
  64.     }
  65. }
  66.  
  67. // Byebye
  68. saybibi ()
  69. {                             
  70.     puts ("\nExpWarn done!\n");
  71. }
  72.  
  73. // End of script
  74.  
  75.